/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tracker.pc.com.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import tracker.android.sens.impl.ThreadImpl;

import tracker.pc.com.ComPackage;
import tracker.pc.com.ProcessConnectionThread;
import tracker.pc.com.StreamConnection;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Process Connection Thread</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link tracker.pc.com.impl.ProcessConnectionThreadImpl#getEXT_CMD <em>EXT CMD</em>}</li>
 *   <li>{@link tracker.pc.com.impl.ProcessConnectionThreadImpl#getMConnection <em>MConnection</em>}</li>
 *   <li>{@link tracker.pc.com.impl.ProcessConnectionThreadImpl#getKEY_RIGHT <em>KEY RIGHT</em>}</li>
 *   <li>{@link tracker.pc.com.impl.ProcessConnectionThreadImpl#getKEY_LEFT <em>KEY LEFT</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProcessConnectionThreadImpl extends ThreadImpl implements ProcessConnectionThread {
	/**
	 * The default value of the '{@link #getEXT_CMD() <em>EXT CMD</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEXT_CMD()
	 * @generated
	 * @ordered
	 */
	protected static final int EXT_CMD_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getEXT_CMD() <em>EXT CMD</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEXT_CMD()
	 * @generated
	 * @ordered
	 */
	protected int exT_CMD = EXT_CMD_EDEFAULT;

	/**
	 * The cached value of the '{@link #getMConnection() <em>MConnection</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMConnection()
	 * @generated
	 * @ordered
	 */
	protected StreamConnection mConnection;

	/**
	 * The default value of the '{@link #getKEY_RIGHT() <em>KEY RIGHT</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKEY_RIGHT()
	 * @generated
	 * @ordered
	 */
	protected static final int KEY_RIGHT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getKEY_RIGHT() <em>KEY RIGHT</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKEY_RIGHT()
	 * @generated
	 * @ordered
	 */
	protected int keY_RIGHT = KEY_RIGHT_EDEFAULT;

	/**
	 * The default value of the '{@link #getKEY_LEFT() <em>KEY LEFT</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKEY_LEFT()
	 * @generated
	 * @ordered
	 */
	protected static final int KEY_LEFT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getKEY_LEFT() <em>KEY LEFT</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKEY_LEFT()
	 * @generated
	 * @ordered
	 */
	protected int keY_LEFT = KEY_LEFT_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProcessConnectionThreadImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ComPackage.Literals.PROCESS_CONNECTION_THREAD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getEXT_CMD() {
		return exT_CMD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StreamConnection getMConnection() {
		if (mConnection != null && mConnection.eIsProxy()) {
			InternalEObject oldMConnection = (InternalEObject)mConnection;
			mConnection = (StreamConnection)eResolveProxy(oldMConnection);
			if (mConnection != oldMConnection) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION, oldMConnection, mConnection));
			}
		}
		return mConnection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StreamConnection basicGetMConnection() {
		return mConnection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMConnection(StreamConnection newMConnection) {
		StreamConnection oldMConnection = mConnection;
		mConnection = newMConnection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION, oldMConnection, mConnection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getKEY_RIGHT() {
		return keY_RIGHT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getKEY_LEFT() {
		return keY_LEFT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void processCommand(EList<Byte> buffer, int length) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void processCommand(int command) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ComPackage.PROCESS_CONNECTION_THREAD__EXT_CMD:
				return getEXT_CMD();
			case ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION:
				if (resolve) return getMConnection();
				return basicGetMConnection();
			case ComPackage.PROCESS_CONNECTION_THREAD__KEY_RIGHT:
				return getKEY_RIGHT();
			case ComPackage.PROCESS_CONNECTION_THREAD__KEY_LEFT:
				return getKEY_LEFT();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION:
				setMConnection((StreamConnection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION:
				setMConnection((StreamConnection)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ComPackage.PROCESS_CONNECTION_THREAD__EXT_CMD:
				return exT_CMD != EXT_CMD_EDEFAULT;
			case ComPackage.PROCESS_CONNECTION_THREAD__MCONNECTION:
				return mConnection != null;
			case ComPackage.PROCESS_CONNECTION_THREAD__KEY_RIGHT:
				return keY_RIGHT != KEY_RIGHT_EDEFAULT;
			case ComPackage.PROCESS_CONNECTION_THREAD__KEY_LEFT:
				return keY_LEFT != KEY_LEFT_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (EXT_CMD: ");
		result.append(exT_CMD);
		result.append(", KEY_RIGHT: ");
		result.append(keY_RIGHT);
		result.append(", KEY_LEFT: ");
		result.append(keY_LEFT);
		result.append(')');
		return result.toString();
	}

} //ProcessConnectionThreadImpl
